import { axiosInstance } from 'src/boot/axios'
import CommonConfig from 'src/assets/js/config'

const schemaUrl = CommonConfig.schemaUrl + '/v1'

// 获取生产组织架构-树形选择器结构

function getOrganize () {
  const newUrl = schemaUrl + '/scheme_tree'

  return axiosInstance.get(newUrl).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 列举设备类型
export function getDict () {
  const newUrl = schemaUrl + '/dict_by_gcode'
  const params = {
    dicGroupCode: 'machine_type',
    disable: true
  }

  return axiosInstance.get(newUrl, { params }).then((res) => {
    return Promise.resolve((res))
  })
}

export default {
  getOrganize,
  getDict
}
